﻿@model IEnumerable<ProductCategory>
<div class="pageHeader">
    <form>
    <div class="searchBar">
        <ul class="searchContent">
            <li>
                <label>
                    名称</label>
                <input type="text" name="name" />
            </li>
        </ul>
        <div class="subBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                查找</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="demo_page4.html" target="navTab"><span>添加</span></a></li>
        </ul>
    </div>
    <table id="tree" class="table" width="100%" layouth="138">
        <thead>
            <tr>
                <th width="120">
                    名称
                </th>
                <th width="120">
                    级别
                </th>
                <th width="120">
                    级别
                </th>
                <th>
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @GenerateChildren(Model, 1)
        </tbody>
    </table>
</div>
@helper GenerateChildren(IEnumerable<ProductCategory> model, int level)
    {
        var temp = model.Where(o => o.Level == level);
        foreach (var o in temp)
        {
    <tr id="node-@o.Level" target="param" rel="@o.Id" >
        <td>@o.Name
        </td>
        <td>
        </td>
        <td>
        </td>
        <td>
        </td>
    </tr>
            if (o.HasChildren)
            {
                GenerateChildren(Model,o.Level + 1);
            }
        }
}